package com.csun.cmny.provider.model.enums.watch;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-01-25 15:03
 * @Description:
 */
public enum WatchClockTypeEnum {

    /**
     * 吃药提醒
     */
    TAKE_MEDICINE("0", "吃药提醒"),

    /**
     * 喝水提醒
     */
    DRINK_WATER("1", "喝水提醒"),

    /**
     * 喝水提醒
     */
    SPORT("2", "运动提醒"),

    /**
     * 自定义1
     */
    CUSTOM_1("3", "自定义1"),

    /**
     * 自定义2
     */
    CUSTOM_2("4", "自定义2"),

    /**
     * 自定义3
     */
    CUSTOM_4("5", "自定义5"),;

    /**
     * The Key.
     */
    String key;

    /**
     * The Value.
     */
    String value;

    WatchClockTypeEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * Gets key.
     *
     * @return the key
     */
    public String getKey() {
        return key;
    }

    /**
     * Gets value.
     *
     * @return the value
     */
    public String getValue() {
        return value;
    }

    /**
     * 获取key获取value
     *
     * @param key key
     *
     * @return value value
     */
    public static String getValue(String key) {
        for (WatchClockTypeEnum ele : WatchClockTypeEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele.getValue();
            }
        }
        return null;
    }

    /**
     * 根据key获取该对象
     *
     * @param key key
     *
     * @return this enum
     */
    public static WatchClockTypeEnum getEnum(String key) {
        for (WatchClockTypeEnum ele : WatchClockTypeEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele;
            }
        }
        return null;
    }

    /**
     * 获取List集合
     *
     * @return List list
     */
    public static List<WatchClockTypeEnum> getList() {
        return Arrays.asList(WatchClockTypeEnum.values());
    }


    /**
     * 获取map类型集合
     *
     * @return Map类型List集合 map 2 list
     */
    public static List<Map<String, String>> getMap2List() {
        List<Map<String, String>> list = Lists.newArrayList();
        for (WatchClockTypeEnum ele : WatchClockTypeEnum.values()) {
            Map<String, String> map = Maps.newHashMap();
            map.put("key", ele.getKey());
            map.put("value", ele.getValue());
            list.add(map);
        }
        return list;
    }

}
